<?php

namespace App\Services;

use App\Repositories\TestRepository;

class TestServer
{
    protected $test;

    public function __construct(TestRepository $test)
    {
        $this->test = $test;
    }

    /**
     * 添加
     *
     * @param $post
     * @param null $id
     * @return mixed
     */
    public function create($post)
    {
        //统计数据
        $data['name'] = $post['name'];
        $data['status'] = (int) $post['status'];

        //执行插入
        return $this->test->create($data);
    }

    /**
     * 获取记录
     *
     * @return mixed
     */
    public function get()
    {
        return $this->test->get();
    }
}